package com.mayuhao.loginmanage.controller;

import com.mayuhao.loginmanage.entity.CssUserRoleVO;
import com.mayuhao.loginmanage.service.ICssUserRoleService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 马宇豪
 * @since 2022-10-23
 */
@RestController
//@RequestMapping("/css-user-role")
public class CssUserRoleController {

    @Resource
    private ICssUserRoleService userRoleService;

    /**
     * @return boolean
     * @description 请修改方法描述
     * @methodName login
     * @params [userName, passWord, role]
     * @paramType [java.lang.String, java.lang.String, java.lang.Integer]
     * @author 马宇豪
     * @date 2022/10/23 0023 下午 5:39
     * @email 1757442521@qq.com
     **/
    @PostMapping("/login")
    public CssUserRoleVO login(@RequestBody CssUserRoleVO userRoleVO) {
        return userRoleService.login(userRoleVO);
    }

    /**
     * @return boolean
     * @description 请修改方法描述
     * @methodName changePassword
     * @params [studentId, newpassword]
     * @paramType [java.lang.String, java.lang.String]
     * @author 马宇豪
     * @date 2022/11/12 0012 下午 2:25
     * @email 1757442521@qq.com
     **/
    @PutMapping("/changestudentpassword/{studentId}/{newPassword}")
    public boolean changeStudentPassword(@PathVariable String studentId, @PathVariable String newPassword) {
        return userRoleService.changeStudentPassword(studentId, newPassword);
    }

    /**
     * @return boolean
     * @description 请修改方法描述
     * @methodName changeTeacherPassword
     * @params [teacherId, newPassword]
     * @paramType [java.lang.String, java.lang.String]
     * @author 马宇豪
     * @date 2022/11/12 0012 下午 2:50
     * @email 1757442521@qq.com
     **/
    @PutMapping("/changeteacherpassword/{teacherId}/{newPassword}")
    public boolean changeTeacherPassword(@PathVariable String teacherId, @PathVariable String newPassword) {
        return userRoleService.changeTeacherPassword(teacherId, newPassword);
    }

    /**
     * @return boolean
     * @description 请修改方法描述
     * @methodName changeAdminPassword
     * @params [adminId, newPassword]
     * @paramType [java.lang.String, java.lang.String]
     * @author 马宇豪
     * @date 2022/11/12 0012 下午 2:56
     * @email 1757442521@qq.com
     **/
    @PutMapping("/changeadminpassword/{adminId}/{newPassword}")
    public boolean changeAdminPassword(@PathVariable String adminId, @PathVariable String newPassword) {
        return userRoleService.changeAdminPassword(adminId, newPassword);
    }


}
